home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 48 / 048side1.d81 / bulls & bears (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1988-01-01  |  8.4 KB  |  281 lines

  1. 0 gosub60100:print"[147]":x=rnd(-ti):poke53280,13:poke53281,1
  2. 5 print""spc(12)"bulls and bears[146]":print""
  3. 10 dimn$(20),d(20),p(20),c(20),p1(20),p2(20),sp(12),b(20),i$(9),s(20)
  4. 15 c=7:gosub980:print"[144]number of players (1/2)"
  5. 16 geta$:ifa$<"1"ora$>"2"then16
  6. 17 np=val(a$)
  7. 20 ifnp>2ornp<1thenprint"[145][145]":goto15
  8. 25 c=9:gosub980:print"[144]player 1 initials:";:al=1:nu=.:le=3:gosub60500:p1$=c$
  9. 30 iflen(p1$)<>3thenprint"[145][145][145]":goto25
  10. 35 ifnp=1then50
  11. 40 print:gosub980:print"player 2 initials:";:gosub60500:p2$=c$
  12. 45 iflen(p2$)<>3thenprint"[145][145][145]":goto40
  13. 50 yr=1:i3=6:m(1)=10000:m(2)=10000:pl=1
  14. 55 forx=1to12:readn$(x),d(x):p(x)=100:next
  15. 60 p(11)=120:forx=1to8:readi$(x):next:forx=13to20:readn$(x),p(x):next
  16. 65 print"[147]":s1=0:s2=0:forx=1to20:s1=s1+p1(x)*p(x):s2=s2+p2(x)*p(x):next
  17. 70 n1=int(m1*.02):n2=int(m2*.02)
  18. 75 ifm(1)<0thenn1=n1-int(m(1)*.02)
  19. 80 ifm(2)<0thenn2=n2-int(m(2)*.02)
  20. 85 m(1)=m(1)-n1+d1:m(2)=m(2)-n2+d2:t1=s1+m(1)-m1:t2=m(2)+s2-m2
  21. 90 print"  year:"yr"   quarter:"q:gosub1025
  22. 95 printtab(18)p1$:printtab(18)"[192][192][192]"
  23. 100 print"stocks"spc(15-len(str$(s1)))""s1
  24. 105 ifm(1)<0thenprint"[144]cash"spc(17-len(str$(m(1))))""m(1):goto115
  25. 110 print"[144]cash"spc(17-len(str$(m(1))))""m(1)
  26. 115 print"[144]dividends"spc(12-len(str$(d1)))""d1
  27. 120 print"[144]margins"spc(14-len(str$(m1)))""m1
  28. 125 print"[144]interest"spc(13-len(str$(n1)))""n1
  29. 130 printspc(15)"[144][192][192][192][192][192][192]":print"total"spc(16-len(str$(t1)))t1
  30. 135 ifnp=1then175
  31. 140 print""spc(30)"[144]"p2$:printspc(30)"[192][192][192]"
  32. 145 printspc(33-len(str$(s2)))""s2
  33. 150 ifm(2)<0thenprintspc(33-len(str$(m(2))))""m(2):goto160
  34. 155 printspc(33-len(str$(m(2))))""m(2)
  35. 160 printspc(33-len(str$(d2)))""d2
  36. 165 printspc(33-len(str$(m2)))""m2:printspc(33-len(str$(n2)))n2
  37. 170 printspc(27)"[144][192][192][192][192][192][192]":printspc(33-len(str$(t2)))t2
  38. 175 print:print:print"press space[146] to continue or q[146] to quit":poke198,0
  39. 180 geta$:ifa$=""then180
  40. 182 ifa$="q"then60000
  41. 185 ifa$<>chr$(32)then180
  42. 190 ifbr(1)=1orbr(2)=1then1105
  43. 195 ifyr=10andq=4then1105
  44. 200 print"[147]":gosub1090
  45. 205 ifen>9theny=y-1
  46. 210 ifen<-5theny=y+1
  47. 215 en=en+y:c1=y:gosub1090
  48. 220 ifi1>9theny=y-1
  49. 225 ifi1<-5theny=y+1
  50. 230 i1=i1+c1+y:c2=c1+y:gosub1090
  51. 235 ify=-2theny=0
  52. 240 i2=i2+c2+y:c3=c2+y:gosub1090:i3=i3+y:c4=y
  53. 245 ifi2<-6theni2=i2+1:c3=c3+1
  54. 250 ifi1-i3>2theni3=i3+1:c4=c4+1
  55. 255 ifi1-i3<-2theni3=i3-1:c4=c4-1
  56. 260 ifi3<2theni3=2:c4=0
  57. 265 ifi3<5theni1=i1+1:c2=c2+1
  58. 270 ifi3>12theni1=i1-1:c2=c2-1
  59. 275 d(12)=i3-2
  60. 280 ifd(12)<4thend(12)=4
  61. 285 ifd(12)>9thend(12)=9
  62. 290 gosub1100:c(1)=(c3-c4)*y:c(11)=-(10*c4)
  63. 295 ifp(11)>160thenc(11)=0
  64. 300 ifp(11)<70thenc(11)=c(11)+5
  65. 305 gosub1100:c(4)=(c2+c3)*y:gosub1100:c(5)=(c2+c3)*y-2
  66. 310 gosub1100:c(9)=c1*y*2:gosub1100:c(7)=(c3-c4-c1)*y
  67. 315 gosub1100:c(6)=c3*y:gosub1100:c(3)=-(c1+c4)*y*2
  68. 320 gosub1100:c(10)=(c2+c4)*y*2:gosub1100:c(2)=-(c2+c4)*y*2
  69. 325 gosub1100:c(8)=-c1*y:c(9)=c(9)+c1:c(10)=c(10)+(5*c2):gosub1100
  70. 330 ifi2>5thenc(4)=c(4)+y:c(7)=c(7)+y:c(6)=c(6)+y
  71. 335 ifi2<0thenc(4)=c(4)-y:c(7)=c(7)-(y*2):c(6)=c(6)-(y*2)
  72. 340 gosub1100
  73. 345 ifi3>10thenc(1)=c(1)-(2*y):c(2)=c(2)-(3*y):c(3)=c(3)-y
  74. 350 ifi3<5thenc(1)=c(1)+(2*y):c(2)=c(2)+(3*y):c(3)=c(3)+y
  75. 355 forx=1to10:y=int(rnd(1)*10)
  76. 360 ify>6theny=y-10
  77. 365 c(x)=c(x)+(2*y):next
  78. 370 forx=1to11
  79. 375 ifb(x)=1thenp(x)=100:b(x)=0
  80. 380 p(x)=p(x)+c(x)
  81. 385 ifp(x)=<0thenp(x)=0:b(x)=1
  82. 390 ifp(x)>199thenp(x)=int(p(x)/2):sp(x)=1
  83. 395 next
  84. 400 forx=1to10:ifsp(x)=0thennext:goto410
  85. 405 p1(x)=p1(x)*2:p2(x)=p2(x)*2:sp(x)=1:next
  86. 410 forx=13to(12+ip)
  87. 415 ifb(x)=0thennextx:goto430
  88. 420 ifb(x)=1thenb(x)=2
  89. 425 next
  90. 430 forx=13to(12+ip):gosub1090:p(x)=p(x)+y
  91. 435 ifp(x)>0thennext:goto450
  92. 440 ifb(x)=2thennext:goto450
  93. 445 p1(x)=0:p2(x)=0:p(x)=0:b(x)=1:next
  94. 450 q=q+1:ifq=5thenq=1:yr=yr+1
  95. 455 ifnp=1orpl=1then470
  96. 460 pl$=p2$:m=m(2):mt=m2:tl=m-mt
  97. 463 forx=1to20:s(x)=p2(x):tl=tl+s(x)*p(x):next
  98. 465 goto475
  99. 470 pl$=p1$:m=m(1):mt=m1:tl=m-mt
  100. 473 forx=1to20:s(x)=p1(x):tl=tl+s(x)*p(x):next
  101. 475 gosub1035:iftl<0thenbr(pl)=1
  102. 480 print"[147]":print"year:"yr" quarter:"q"    player: "pl$
  103. 485 print"[144]stk div prc chg   shrs [221]stk prc   shrs"
  104. 490 print"[192][192][192] [192][192][192] [192][192][192] [192][192][192]   [192][192][192][192] [221][192][192][192] [192][192][192]   [192][192][192][192]"
  105. 495 forx=1to12:y=len(str$(s(x))):y1=len(str$(p(x))):z=len(str$(c(x)))
  106. 500 print""n$(x)" "d(x)spc(4-y1)p(x)spc(3-z)c(x)spc(6-y)s(x)"[144][221]":next
  107. 505 print"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  108. 510 ifpl=2then585
  109. 515 ifq<>1oryr>8then525
  110. 520 gosub1030:nw=1:ip=ip+1:printspc(6)"new issue: "i$(ip)
  111. 525 forx=1to12+ip
  112. 530 ifb(x)<>1thennext:goto545
  113. 535 ifnw=0thengosub1030:nw=1
  114. 540 printspc(6)""n$(x)" declares bankruptcy":next
  115. 545 forx=1to11
  116. 550 ifsp(x)=0thennext:goto565
  117. 555 ifnw=othengosub1030:nw=1
  118. 560 printspc(6)""n$(x)" declares 2-for-1 split":sp(x)=0:next
  119. 565 ifnw=0then585
  120. 570 forx=1to3000:next
  121. 575 nw=0:l=15:gosub985
  122. 580 forx=1to6:printspc(5)"                               ":next
  123. 583 l=15:gosub985
  124. 585 print"[145]"spc(23)"[144][179]"
  125. 590 ifbr(pl)=1thenprint"  bankrupt[146]":print"[145]"spc(23)"[144][221]":goto605
  126. 595 ifmc>0thenprint:goto605
  127. 600 print" [144]b[146]uy    s[146]ell    e[146]xit   [221]"
  128. 605 print"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][178][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  129. 610 print"":print:print
  130. 615 forx=13to12+ip:y=len(str$(s(x))):z=9-len(str$(p(x)))
  131. 620 ifb(x)=2thennext:goto630
  132. 625 printspc(24)"[156]"n$(x)" "p(x)spc(z-y)s(x):next
  133. 630 l=10:gosub985:printspc(23)"[144][171][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  134. 635 printspc(26)" [129]indexes[146]"
  135. 640 printspc(24)" energy    "en:printspc(24)" economy   "i2
  136. 645 printspc(24)" interest  "i3:printspc(24)" inflation "i1
  137. 650 printspc(23)"[144][177][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  138. 655 print"cash="m:print"comm="cm:print"marg="mt
  139. 660 print"[145][145][145]"spc(15)"[144][221]":printspc(15)"[221]":printspc(15)"[221]"
  140. 665 print"[192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][177][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
  141. 670 ifbr(pl)=0then680
  142. 675 forx=1to2000:next:goto1050
  143. 680 ifmc=0then700
  144. 685 l=15:gosub985:print" margin call:[146]"mc
  145. 690 print"[145]"spc(23)"[144][221]"
  146. 695 gosub825:mc=mc-x:ifmc>0thenprint"[145][145]"spc(14)"       ":goto685
  147. 700 fl=-1:poke198,.
  148. 701 print"";
  149. 702 if(fl)thenprint" [144]b[146]uy    s[146]ell    e[146]xit   "
  150. 705 ifnot(fl)thenprint" [144] uy     ell     xit   "
  151. 710 geta$:ifa$=""thenfl=not(fl):goto701
  152. 711 print" [144]b[146]uy    s[146]ell    e[146]xit   "
  153. 715 ifa$="b"thengosub735:goto701
  154. 720 ifa$="s"thengosub825:goto701
  155. 725 ifa$="e"then1050
  156. 730 fl=not(fl):goto701
  157. 735 gosub950:mr=0:printspc(21)"[144]buy on margin?":poke198,0
  158. 740 geta$:ifa$=""then740
  159. 745 ifa$="y"thenmr=1:goto755
  160. 750 ifa$<>"n"then740
  161. 755 gosub990:ifa$="x"thenreturn
  162. 760 ifmr=0then775
  163. 765 ifm-z/2<-1000thengosub955:gosub1020:goto765
  164. 770 mt=mt+int(z/2):m=m-int(z/2):goto785
  165. 775 ifm-z<-1000thengosub955:gosub1020:goto775
  166. 780 m=m-z:ifx=0then795
  167. 785 s(y)=s(y)+x
  168. 790 z=int(x*.1)+1:m=m-z:cm=cm+z+10
  169. 795 gosub950
  170. 800 printtab(7)"        "spc(4)"                    "
  171. 805 printtab(7)"        "spc(4)"                    "
  172. 810 printtab(7)"        "spc(4)"                    "
  173. 815 gosub950:print"cash="m:print"comm="cm:print"marg="mt
  174. 820 gosub890:gosub950:return
  175. 825 gosub990:ifa$="x"then845
  176. 830 ifx>s(y)thengosub960:gosub1020:goto830
  177. 835 m=m+z:s(y)=s(y)-x:gosub790
  178. 840 ifmt=0thengosub940:return
  179. 845 printspc(22)"[144]pay margin?":poke198,0
  180. 850 geta$:ifa$=""then850
  181. 855 ifa$="y"then870
  182. 860 ifa$="n"thengosub940:return
  183. 865 goto850
  184. 870 c=22:gosub980:print"amount:";:nu=1:al=.:le=8:gosub60500:x=val(c$)
  185. 875 ifm-x<-1000thengosub955:goto870
  186. 880 ifx>mtthenx=mt
  187. 885 m=m-x:mt=mt-x:goto795
  188. 890 z=len(str$(s(y)))
  189. 895 ify>12then915
  190. 900 ify=0thenreturn
  191. 905 l=y+1:gosub985:printspc(17)"     "
  192. 910 print"[145]"spc(22-z)s(y):return
  193. 915 l=y-11:forx=13toy:ifb(x)=2thenl=l-1
  194. 920 next:gosub985:printspc(32)"[156]      "
  195. 925 print"[145]"spc(38-len(str$(s(y))))s(y):return
  196. 930 printtab(19)"incorrect input"
  197. 935 forx=1to2000:next
  198. 940 l=17:gosub985
  199. 945 forx=1to3:printtab(16)"                      ":next
  200. 950 l=17:gosub985:return
  201. 955 printtab(19)"not enough money":goto965
  202. 960 printtab(19)"not enough shares"
  203. 965 forx=1to2000:next:print"[145][145]"spc(21)"                "
  204. 970 printtab(19)"                  "
  205. 975 l=18:gosub985:return
  206. 980 poke211,c:return
  207. 985 poke214,l:print:return
  208. 990 a$="x":y=0:gosub940:c=22:gosub980:print"[144]stock:";
  209. 992 al=1:nu=.:le=3:gosub60500:a$=c$
  210. 995 ifa$="x"thengosub940:return
  211. 1000 iflen(a$)<>3thengosub930:goto990
  212. 1005 forx=1to20:ifa$=n$(x)theny=x
  213. 1010 next
  214. 1015 ify=0thengosub930:goto990
  215. 1020 gosub980:x=0:print"[144]shares:";
  216. 1022 le=6:al=.:nu=1:gosub60500:x=val(c$):z=x*p(y):return
  217. 1025 print"[144] [192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]":return
  218. 1030 printspc(13)"[129]*market news*":return
  219. 1035 tl=m-mt:forx=1to20:tl=tl+p(x)*s(x):next
  220. 1040 ifmt>int(tl/2)thenmc=mt-int(tl/2):return
  221. 1045 mc=0:return
  222. 1050 cm=0:tr=0
  223. 1055 ifq<>4thend=int(d(12)/4)*s(12):goto1065
  224. 1060 forx=1to11:d=d+d(x)*s(x):next:d=d+(d(12)-3*int(d(12)/4))*s(12)
  225. 1065 ifpl=1then1075
  226. 1070 d2=d:d=0:pl=1:m(2)=m:m2=mt:forx=1to20:p2(x)=s(x):next:goto65
  227. 1075 d1=d:d=0:pl=2:m(1)=m:m1=mt:forx=1to20:p1(x)=s(x):next
  228. 1080 ifnp=1thenpl=1:goto65
  229. 1085 goto460
  230. 1090 y=int(rnd(1)*5):ify>2theny=y-5
  231. 1095 return
  232. 1100 y=int(rnd(1)*3)+1:return
  233. 1105 print:gosub1025
  234. 1108 ifnp=1andbr(1)=1thenprint" you are bankrupt":goto1150
  235. 1110 ifbr(1)=1andbr(2)=1then1175
  236. 1115 ifbr(1)=1thengosub2000:goto1150
  237. 1120 ifbr(2)=1thengosub2100:goto1150
  238. 1125 ifnp=1then1150
  239. 1130 ift1>t2thenpl$=p1$:goto1145
  240. 1135 ift2>t1thenpl$=p2$:goto1145
  241. 1140 print:print"[144] *no winner*[146]":goto1150
  242. 1145 print:print" "pl$" is the winner"
  243. 1150 print:print"[144] game over[146]--play again?":poke198,0
  244. 1155 geta$:ifa$=""then1155
  245. 1160 ifa$="y"thenclr:goto0
  246. 1165 ifa$<>"n"then1155
  247. 1170 goto60000
  248. 1175 print" "p1$" is bankrupt     "p2$" is bankrupt":goto1140
  249. 1180 databnk,2,fin,6,utl,5,con,2,def,0,mfg,1
  250. 1185 datagmc,3,twa,0,exo,4,min,0,bnd,8,mkt,4
  251. 1190 data wildcat drilling,genetic research,gold nugget mine
  252. 1195 data diode electronics,urban development,texas exploration
  253. 1200 data energy associates,dooms day mining
  254. 1205 data wil,2,gen,5,gol,2,dio,4,urb,4,tex,2,ena,5,dom,2
  255. 2000 print" "p1$" is bankrupt     "p2$" is the winner":return
  256. 2100 print" "p2$" is bankrupt    "p1$" is the winner":return
  257. 60000 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
  258. 60010 ifer<>63thenend
  259. 60020 load"hello connect",8
  260. 60100 poke53280, 6:poke53281, 0:print"[147][142]";
  261. 60110 print"loadstarpresents"
  262. 60120 print"[164][164][164][164][164][164][164][164][164][164]                   [146][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]  bulls a";
  263. 60130 print"nd bears  [146][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]                   [146][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]";
  264. 60140 print"[164][164][164][164][164]   by  kirk ward   [146][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]                   [146]";
  265. 60150 print"[164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]  copyright  1988  [146][164][164][164][164][164][164][164][164][164][164][164]     ";
  266. 60160 print"              "
  267. 60170 print"pressspacetocontinue"
  268. 60180 ifpeek(203)<>60then60180
  269. 60190 return
  270. 60500 c$="":poke198,.:print"[164]";
  271. 60510 fora=1tole+1
  272. 60520 geta$:ifa$=""then60520
  273. 60530 ifa$=chr$(13)thenprint"[157] ":return
  274. 60540 ifa$=chr$(20)anda>1thenprint"[157][157]  [157][157][164]";:a=a-1:c$=left$(c$,a-1):goto60520
  275. 60550 if(a=le+1)then60520
  276. 60560 if(nu)and((a$>="0")and(a$<="9"))then60595
  277. 60570 if(al)and((a$>=" "anda$<="/")or(a$>=":"anda$<="z"))then60595
  278. 60580 if(al)thenif(a$>="[193]"anda$<="[218]")then60595
  279. 60590 goto60520
  280. 60595 print"[157]"a$;:poke212,.:print"[164]";:c$=c$+a$:next
  281.